<style type="text/css">
    .ui-datepicker{ font-size: 14px; width: 230px; }
    .ui-datepicker select.ui-datepicker-month{ width:30%; font-size: 11px; }
    .ui-datepicker select.ui-datepicker-year{ width:40%; font-size: 11px; }
</style>
<script>
    $(document).ready(function($)
    {
        if($('#gift option:selected').val() == 'item')
        {
            $('#item_ea').attr('disabled', false);
            $('#item').attr('disabled', false);
            $('#ea').attr('disabled', true);
        }
        else
        {
            $('#item_ea').attr('disabled', true);
            $('#item').attr('disabled', true);
            $('#ea').attr('disabled', false);
        }

        $("#gift").change(function()
        {
            if($('#gift option:selected').val() == 'item')
            {
                $('#item_ea').attr('disabled', false);
                $('#item').attr('disabled', false);
                $('#ea').attr('disabled', true);
            }
            else
            {
                $('#item_ea').attr('disabled', true);
                $('#item').attr('disabled', true);
                $('#ea').attr('disabled', false);
            }
        });

        $('#set_date').datetimepicker({
            dateFormat: 'yy-mm-dd',
            timeFormat: 'HH:mm',
            stepHour: 1,
            stepMinute: 1
        });

        var startDateTextBox = $('#block_start_date');
        var endDateTextBox = $('#block_end_date');

        startDateTextBox.datetimepicker({
            dateFormat: 'yy-mm-dd',
            timeFormat: 'HH:mm',
            stepHour: 1,
            stepMinute: 1,
            onClose: function(dateText, inst) {
                if (endDateTextBox.val() != '') {
                    var testStartDate = startDateTextBox.datetimepicker('getDate');
                    var testEndDate = endDateTextBox.datetimepicker('getDate');
                    if (testStartDate > testEndDate)
                        endDateTextBox.datetimepicker('setDate', testStartDate);
                }
                else {
                    endDateTextBox.val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
            }
        });
        endDateTextBox.datetimepicker({
            dateFormat: 'yy-mm-dd',
            timeFormat: 'HH:mm',
            stepHour: 1,
            stepMinute: 1,
            onClose: function(dateText, inst) {
                if (startDateTextBox.val() != '') {
                    var testStartDate = startDateTextBox.datetimepicker('getDate');
                    var testEndDate = endDateTextBox.datetimepicker('getDate');
                    if (testStartDate > testEndDate)
                        startDateTextBox.datetimepicker('setDate', testEndDate);
                }
                else {
                    startDateTextBox.val(dateText);
                }
            },
            onSelect: function (selectedDateTime){
                startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
            }
        });

    });
</script>

<div class="tales_stats_menu">
    <ui>
        <li class="tales_of_deonia"><?php echo __(LANG_TALES_OF_DEONIA)?></li>
    </ui>
</div>

<!-- 셋팅 메뉴 -->
<div class="tales_stats_menu">
    <ul>
        <li class="actions">
            <?php echo $this->Html->link(__(LANG_BACK), array(
                'controller' => 'User',
                'action' => 'user_select',
                'id' => $this->passedArgs['id'],
                'search_value' => $this->passedArgs['search_value'],
            ));?>
        </li>
    </ul>
</div>
<div class="send_gift_main">
<div class="send_gift_main_left">
    <div class="send_gift_main_left_one">
        <div class="div_title"><?php echo __(LANG_CHARACTER_LIST)?></div>
        <table>
            <tr>
                <th style="width: 30px"><?php echo __(LANG_NUM)?></th>
                <th><?php echo __(LANG_NAME)?></th>
                <th style="width: 77px"><?php echo __(LANG_TYPE)?></th>
                <th style="width: 43px"><?php echo __(LANG_LEVEL)?></th>
            </tr>
            <?php if(!empty($user_character_list)) {?>
                <?php $num = '';?>
                <?php foreach($user_character_list as $num => $character) {?>
                    <tr>
                        <td class="user_link">
                            <?php echo $this->Html->link($num+1, array(
                                'action' => 'setting_index',
                                'id' => $character['tbl_character']['a2x_id'],
                                'char_serial' => $character['tbl_character']['char_serial'],
                                'search_value' => $this->passedArgs['search_value'],
                            ));?>
                        </td>
                        <td class="user_link">
                            <?php echo $this->Html->link($character['tbl_character']['char_name'], array(
                                'action' => 'setting_index',
                                'id' => $character['tbl_character']['a2x_id'],
                                'char_serial' => $character['tbl_character']['char_serial'],
                                'search_value' => $this->passedArgs['search_value'],
                            ));?>
                        </td>
                        <td class="user_link">
                            <?php echo $this->Html->link($character['tbl_character']['char_type'], array(
                                'action' => 'setting_index',
                                'id' => $character['tbl_character']['a2x_id'],
                                'char_serial' => $character['tbl_character']['char_serial'],
                                'search_value' => $this->passedArgs['search_value'],
                            ));?>
                        </td>
                        <td class="user_link">
                            <?php echo $this->Html->link($character['tbl_character']['level'], array(
                                'action' => 'setting_index',
                                'id' => $character['tbl_character']['a2x_id'],
                                'char_serial' => $character['tbl_character']['char_serial'],
                                'search_value' => $this->passedArgs['search_value'],
                            ));?>
                        </td>
                    </tr>
                <?php }?>
            <?php }?>
        </table>
    </div>
    <div class="send_gift_main_left_two">
        <div>
            <?php echo $this->Form->create('billing_log');?>
            <?php echo $this->Form->hidden('a2x_id', array(
                'label' => false,
                'value' => $this->passedArgs['id']
            ));?>
        </div>
        <div class="div_title"><?php echo __(LANG_BILLING_SETTING)?></div>
        <table border="0">
            <tr>
                <th class="user" style="width: 100px"><?php echo __(LANG_ORDER_ID)?></th>
                <td class="background_white" colspan="3" style="padding-right: 18px">
                    <?php echo $this->Form->input('order_id', array(
                        'label' => false,
                        'type' => 'text',
                        'value' => empty($billing['order_id'])?'':$billing['order_id'],
                    ));?>
                </td>
            </tr>
            <tr>
                <th class="user"><?php echo __(LANG_GEM)?></th>
                <td class="background_white" style="padding-top:10px">
                    <?php echo $this->Form->input('gem', array(
                        'label' => false,
                        'type' => 'select',
                        'options' => cashOption()
                    ));?>
                </td>
                <th class="user"><?php echo __(LANG_PAY_DATE)?></th>
                <td class="background_white" style="width: 160px;padding-right: 18px;">
                    <?php echo $this->Form->input('reg_date', array(
                        'label' => false,
                        'type' => 'text',
                        'id' => 'set_date',
                        'value' => empty($billing['reg_date'])?'':$billing['reg_date'],
                    ));?>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td class="message_box no_border" style="width: 300px">
                    <?php if(!empty($billing_err_msg)) {?>
                        <p class="error_message"><?php echo $billing_err_msg?></p>
                    <?php } else  if(!empty($billing_msg)){?>
                        <p class="success_message"><?php echo $billing_msg?></p>
                    <?php }?>
                </td>
                <td class="no_border" colspan="4" style="text-align: right">
                    <?php echo $this->Form->end(__(LANG_SEND));?>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="send_gift_main_bottom">
    <div class="send_gift_botton_one">
        <?php if(empty($this->passedArgs['char_serial'])) {?>
            <div class="div_title"><?php echo __(LANG_SEND_GIFT)?></div>
            <p class="info_empty_text "><?php echo __(LANG_CHOOSE_CHAR)?></p>
        <?php }?>
        <?php if(!empty($this->passedArgs['char_serial'])) {?>
            <div class="div_title"><?php echo __(LANG_SEND_GIFT . '(' . $character['tbl_character']['char_name'] . ')')?></div>
            <div>
                <?php echo $this->Form->create('gift_item');?>
                <?php echo $this->Form->hidden('char_serial', array(
                    'label' => false,
                    'value' => $this->passedArgs['char_serial']
                ));?>
            </div>
            <table>
                <tr>
                    <th class="user" style="width: 90px"><?php echo __('Message')?></th>
                    <td class="background_white" colspan="2" style="padding-right: 19px">
                        <?php echo $this->Form->input('message', array(
                            'label' => false,
                            'type' => 'text',
                            'value' => '',
                        ));?>
                    </td>
                </tr>
                <tr>
                    <th class="user" rowspan="2"><?php echo __('Gift Choice')?></th>
                    <td class="background_white" style="padding-right: 19px;padding-top: 10px">
                        <?php echo $this->Form->input('gift', array(
                            'label' => false,
                            'type' => 'select',
                            'id' => 'gift',
                            'options' => giftOption()
                        ));?>
                    </td>
                    <td class="background_white" style="padding-right: 19px">
                        <?php echo $this->Form->input('ea', array(
                            'label' => false,
                            'type' => 'text',
                            'id' => 'ea'
                        ));?>
                    </td>
                </tr>
                <tr>
                    <td class="background_white" style="width:60px;padding-right: 19px;">
                        <?php echo $this->Form->input('item_ea', array(
                            'label' => false,
                            'type' => 'text',
                            'id' => 'item_ea',
                            'value' => 1
                        ));?>
                    </td>
                    <td class="background_white" style="padding-right: 19px;padding-top: 10px">
                        <?php echo $this->Form->input('item', array(
                            'label' => false,
                            'type' => 'select',
                            'id' => 'item',
                            'options' => $gift_item_option
                        ));?>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td class="message_box no_border">
                        <?php if(!empty($send_err_msg)) {?>
                            <p class="error_message"><?php echo $send_err_msg?></p>
                        <?php } else  if(!empty($send_msg)){?>
                            <p class="success_message"><?php echo $send_msg?></p>
                        <?php }?>
                    </td>
                    <td class="no_border" colspan="4" style="text-align: right">
                        <?php echo $this->Form->end(__(LANG_SEND));?>
                    </td>
                </tr>
            </table>
        <?php }?>
    </div>
    <!--<div class="send_gift_botton_two">
        <div>
            <?php /*echo $this->Form->create('block_log');*/?>
            <?php /*echo $this->Form->hidden('a2x_id', array(
                'label' => false,
                'value' => $this->passedArgs['id']
            ));*/?>
        </div>
        <div class="div_title"><?php /*echo __('Block Setting')*/?></div>
        <table>
            <tr>
                <th class="user" style="width: 50px"><?php /*echo __('Start')*/?></th>
                <td class="background_white" colspan="3" style="padding-right: 18px">
                    <?php /*echo $this->Form->input('start_date', array(
                        'label' => false,
                        'type' => 'text',
                        'id' => 'block_start_date',
                        'value' => '',
                    ));*/?>
                </td>
            </tr>
            <tr>
                <th class="user" style="width: 50px"><?php /*echo __('End')*/?></th>
                <td class="background_white" colspan="3" style="padding-right: 18px">
                    <?php /*echo $this->Form->input('end_date', array(
                        'label' => false,
                        'type' => 'text',
                        'id' => 'block_end_date',
                        'value' => '',
                    ));*/?>
                </td>
            </tr>
        </table>
        <table>
            <tr>
                <td class="message_box no_border">
                    <?php /*if(!empty($err_msg)) {*/?>
                        <p class="error_message"><?php /*echo $err_msg*/?></p>
                    <?php /*} else  if(!empty($sus_msg)){*/?>
                        <p class="success_message"><?php /*echo $sus_msg*/?></p>
                    <?php /*}*/?>
                </td>
                <td class="no_border" colspan="4" style="text-align: right">
                    <?php /*echo $this->Form->end(__(LANG_SEND));*/?>
                </td>
            </tr>
        </table>
    </div>-->
</div>
</div>